The present invention relates to computer fonts. More specifically, the present invention relates to emboldening computer fonts and, even more particularly described, this invention relates to emboldening scalable outline computer fonts.
Fonts used in traditional lead-based typography and modern computer typography are usually organized into font families. Font families are groups of font faces that are similar in appearance, but which have one or several characteristics that vary from one font to another within the family. For instance, xe2x80x98Arialxe2x80x99 is a well-known font family that consists of four font faces known as Arial Regular, Arial Italic, Arial Bold, and Arial Bold Italic. All of these faces are similar in appearance, but vary from one another to the extent that they are italicized, emboldened, or both.
To produce high quality printed fonts, each glyph in each face of a font family must be individually designed. For instance, each glyph in the Arial Regular, Arial Italic, Arial Bold and Arial Bold Italic faces must be designed individually to ensure high print and display quality. This process of individually designing each glyph is very time consuming and expensive. This is especially true for Far East fonts, which may contain thousands, or even tens of thousands of glyphs.
To eliminate the burden of designing individual font faces, fonts may be simulated from the regular face. For instance, an italic face can be simulated from the regular face by applying a small xe2x80x9cskewingxe2x80x9d transformation to the outline of the font. Methods also exist for simulating an emboldened font from a regular font, however, all of the current methods for simulating an emboldened font suffer from serious disadvantages.
Current methods for simulating emboldened fonts utilize a rendered bitmap of the font to generate the simulated bold font, as opposed to the font outline. For instance, a bold face font may be simulated by rendering a bitmap image of the font in its regular face, offsetting the glyphs in the horizontal and/or vertical directions, and then rendering the bitmap of the regular face again in the new location. That is, the regular glyph is drawn, shifted several picture elements (pixels) horizontally and/or vertically, and another regular glyph is drawn. In this manner, the bitmap is xe2x80x9csmearedxe2x80x9d several pixels in each direction which causes the font to appear to be emboldened.
Although, current methods for simulating emboldened fonts such as the one described above create satisfactory bold face fonts, they suffer from a number of serious drawbacks. The most serious of these problems is the result of the difference in screen resolution, typically around 75 pixels/inch, and printer resolution, which is typically 300-600 pixels/inch. Because printer resolution is much higher than screen resolution, on-screen fonts that are emboldened by shifting the glyph a few pixels in each direction as described above will not appear emboldened when printed. This is especially true when a large font is printed because although several pixels may be noticeable on a low resolution screen display, they are virtually invisible when printed on a high resolution printer. Therefore, current emboldening methods do not permit satisfactory xe2x80x98what you see is what you getxe2x80x99 (xe2x80x9cWYSIWYGxe2x80x9d) printing of simulated emboldened fonts. Other problems with the current methods for simulated emboldening include heavy memory usage when large fonts are used, and the inability to print emboldened fonts in xe2x80x9coutline modexe2x80x9d (i.e. by transmitting only glyph outlines to the printer).
Therefore, in light of these problems, there is a need for a method for emboldening a scalable outline font that preserves WYSIWYG printing, that reduces memory usage, and that permits printing of emboldened fonts in xe2x80x9coutline mode.xe2x80x9d
The present invention solves the problems described above by emboldening the outline that describes a font rather than emboldening the font bitmap. By emboldening the font outline rather than the font bitmap, a number of advantages are achieved. In particular, fonts emboldened using the algorithm of the present invention will be printed exactly as they appear on screen, which is not possible with bitmap emboldening. Moreover, fonts emboldened using the algorithm of the present invention retain hinting, behave well under transformation (i.e. rotation and skewing), and may be printed in xe2x80x9coutline mode.xe2x80x9d
Generally described, the present invention emboldens a glyph by moving the outline that describes the glyph along a vector normal to the direction of the outline by a predetermined distance. This predetermined distance controls how much emboldening will be applied to the glyph. The greater the predetermined distance, the more emboldened the font will appear.
More specifically described, the present invention emboldens a glyph by moving the control points that define the glyph outline. These control points define the font outline and are either on the outline (xe2x80x9con-curve pointsxe2x80x9d) or off of the outline (xe2x80x9coff-curve pointsxe2x80x9d). By moving all of the control points that define a font outline a predetermined distance along a vector perpendicular to the outline, a new outline is created that is the predetermined distance from the original outline. The new outline provides the emboldened version of the glyph.
The new coordinates for each of the control points that define the glyph outline are calculated by first selecting a current control point. Next, an outer normal vector is computed that is perpendicular to a line segment between the current control point and the previous control point. The outer normal vector is a vector perpendicular to, the tangent to the curve at the location of the current control point. The direction of the outer normal vector is 90 degrees counter clockwise from the direction of the tangent. An outer normal vector is also computed that is perpendicular to a line segment between the current control point and the next control point on the outline.
Once these two outer normal vectors are computed, they are normalized to the unit length of one pixel. The normalized outer normal vectors are then decomposed into their horizontal and vertical components. Next, the horizontal components are multiplied by a horizontal displacement to obtain displaced horizontal components, and the vertical components are multiplied by a vertical displacement to obtain displaced vertical components. The displaced horizontal and vertical components of the normalized outer normal vectors are then added to obtain a previous displacement vector and a next displacement vector.
Once the previous and next displacement vectors have been calculated, the previous control point and the current control point are displaced by the previous displacement vector to obtain a previous displacement point and a first candidate point for the new position of the current control point. Likewise, the next control point and the current control point are displaced by the next displacement vector to obtain a next displacement point and a second candidate point for the new position of the current control point.
The line segment defined by the previous displacement point and the first candidate point is then intersected with the line segment defined by the next displacement point and the second candidate point. The location of the intersection of these two line segments is the new emboldened location for the current control point. A boundary check may be performed to ensure that the new location is within a tolerable distance of the current control point.
This process is repeated for each control point on a glyph outline, and for each outline in a glyph to be emboldened. Once each control point has been moved in this manner, the emboldened glyph has been created and the glyph may be rendered by filling in the outline. Because the glyph outline is emboldened after hinting, and because horizontal and vertical features of the outline are moved by integer amounts, the hinting is preserved by the emboldening process to a maximal possible extent. Because the non-scaling part of the font transform, for instance, rotation and shear, are applied to the glyph outline after emboldening, correct emboldening is assured under non-trivial transforms.
That the present invention improves over the drawbacks of the prior art and accomplishes the objects of the invention will become apparent from the detailed description of the illustrative embodiment to follow.